package glassline.driver;

import glassline.ConveyorAgent;
import glassline.Glass;
import glassline.Glass.GlassShape;
import glassline.Glass.WorkStation;
import glassline.NCCutterAgent;
import glassline.PopupAgent;
import glassline.RobotAgent;
import glassline.SensorAgent;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Timer;
import java.util.TimerTask;

import javax.swing.JFrame;

import transducer.TChannel;
import transducer.TEvent;
import transducer.Transducer;

public class main extends JFrame implements KeyListener{

	static Transducer t = new Transducer();
	static Timer timer = new Timer();
	
	public static void main(String[] args)
	{
		main Main = new main();
		ConveyorAgent conveyor = new ConveyorAgent(t, null, null);
		//ConveyorAgent prevconveyor = new ConveyorAgent(t, conveyor, null);
		PopupAgent popup = new PopupAgent(t);
		RobotAgent robot = new RobotAgent(t);
		NCCutterAgent nccutter = new NCCutterAgent(t, conveyor);
		SensorAgent prePopupSensor = new SensorAgent(t, conveyor, null);
		SensorAgent popupSensor = new SensorAgent(t, conveyor, null);
		SensorAgent endSensor = new SensorAgent(t, conveyor, null);
		WorkStation[] works = {WorkStation.CrossSeamer};
		Glass g = new Glass(GlassShape.Circle, works);//glassshape and workstation list

		
		conveyor.startThread();
		popup.startThread();
		robot.startThread();
		nccutter.startThread();
		prePopupSensor.startThread();
		popupSensor.startThread();
		endSensor.startThread();
		
		conveyor.msgHereIsGlass(g);
		
		timer.schedule(new TimerTask(){
		public void run(){
			runEvent1();
		}
	},4000);
		
		
	}
	
	public static void runEvent1(){
		
	}
	
	public void keyPressed(KeyEvent e)
	{

	}
	@Override
	public void keyReleased(KeyEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void keyTyped(KeyEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	
}
	

